package com.baoyang.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * <p>
 * 货柜信息表
 * </p>
 *
 * @author 金佳军
 * @since 2025-07-05
 */
@Getter
@Setter
@TableName("baoyang_container")
public class Container implements Serializable {

    private static final long serialVersionUID = 1L;

    @JsonSerialize(using= ToStringSerializer.class)
    private Long id;

    /**
     * 货物箱号
     */
    private String boxNo = "";

    /**
     * 货物品名id
     */
    @JsonSerialize(using= ToStringSerializer.class)
    private Long productNameId;

    /**
     * 发货站
     */
    private String shippingStation = "";

    /**
     * 到达站
     */
    private String arrivalStation = "";

    /**
     * 卸货地id
     */
    @JsonSerialize(using= ToStringSerializer.class)
    private Long unloadPointId;

    /**
     * 卸货地
     */
    private String unloadPoint = "";

    /**
     * 装车重量，单位吨
     */
    private String loadingWeight = "";

    /**
     * 卸车重量，单位吨
     */
    private String unloadingWeight = "";

    /**
     * 箱位
     */
    private String containerLot = "";

    /**
     * 司机id
     */
    @JsonSerialize(using= ToStringSerializer.class)
    private Long driverId;

    /**
     * 司机姓名
     */
    private String driverName = "";

    /**
     * 发货日期
     */
    @JsonFormat(timezone = "Asia/Shanghai", pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonSerialize(using = LocalDateSerializer.class)
    @JsonDeserialize(using = LocalDateDeserializer.class)
    private LocalDate shipmentDate;

    /**
     * 到站日期
     */
    @JsonFormat(timezone = "Asia/Shanghai", pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonSerialize(using = LocalDateSerializer.class)
    @JsonDeserialize(using = LocalDateDeserializer.class)
    private LocalDate arrivalDate;

    /**
     * 截止日期
     */
    @JsonFormat(timezone = "Asia/Shanghai", pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonSerialize(using = LocalDateSerializer.class)
    @JsonDeserialize(using = LocalDateDeserializer.class)
    private LocalDate deadlineDate;

    /**
     * 卸货日期
     */
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonFormat(timezone = "Asia/Shanghai",pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime unloadingDate;

    /**
     * 运输状态（1：已发货未到站。2：已到站未运输。3：已运输未卸货。4：已卸货）
     */
    private Integer transportationStatus;

    /**
     * 状态（1：正常。2：到期。3：过期）
     */
    private Integer type;

    /**
     * 删除标志（0代表存在  2代表删除）
     */
    @TableLogic(value = "0", delval = "1")
    private String delFlag;

    /**
     * 创建者
     */
    @TableField(fill = FieldFill.INSERT)
    private String createBy;

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonFormat(timezone = "Asia/Shanghai",pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    /**
     * 更新者
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private String updateBy;

    /**
     * 更新时间
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonFormat(timezone = "Asia/Shanghai",pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

    /**
     * 备注
     */
    private String remark;

    /**
     * 货品名称
     */
    @TableField(exist = false)
    private String projectName;
}
